/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/*
 * @Author: Wang Shuo wangshuo@sgsimulation.com
 * @Date: 2024-07-05 15:31:29
 * @LastEditors: 武兴创 superjava@vip.qq.com
 * @LastEditTime: 2024-08-28 22:29:26
 * @FilePath: \SGFEM\DBManager\Service\Node\NodeService.h"
 */
#pragma once
#include "DBManager/Common/ServiceMacro.h"
#include "DBManager/IRepository/Input/Node/INodeRepository.h"
#include "DBManager/IService/Input/Node/INodeService.h"

/// @brief Node Data manipulation interface
SG_DBMANAGER_NAMESPACE_OPEN
class DBManager_DECLSPEC NodeService : public INodeService
{
    using IRepos = INodeRepository;

  public:
    explicit NodeService (INodeRepository& repos);
    ~NodeService () override;

    FUNCTION_DEFAULT (ServiceDataType)

    /** @brief 根据索引查询节点坐标*/
    void GetNodeCoord (std::size_t index, SG::Algebra::Point& _OUT point) override;

    /** @brief 通过节点下标，计算一组节点的全局坐标
     *
     * 出于性能考虑，调用本函数需要保障 points.size() >= indexes.size()， 防止越界。
     */
    void GetNodeCoord (const std::vector<std::size_t>& indexes, std::vector<SG::Algebra::Point>& _OUT points) override;

  private:
    IRepos& m_repository;
};

SG_DBMANAGER_NAMESPACE_CLOSE
